package com.jianguozh.difs.support.service.sys.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.jianguozh.difs.framework.base.BaseEntity;
import com.jianguozh.difs.support.service.constant.enums.OrgEnum;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;

/**
 * <p>
 * 用户
 * </p>
 *
 * @author hanrs
 * @since 2022-03-17
 */
@Getter
@Setter
@Accessors(chain = true)
@NoArgsConstructor
@TableName("sup_user")
public class User extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 主体(CATERING:餐饮单位;CORPORATE:餐饮主体;SUPPLIER:供货商;SUPERIOR:主管单位;)
     */
    private OrgEnum org;

    /**
     * 主体id
     */
    private String orgId;

    /**
     * 主体默认账号
     */
    private Boolean orgDefault;

    /**
     * 账号(用户名)
     */
    private String username;

    /**
     * 密码
     */
    private String password;

    /**
     * 姓名
     */
    private String name;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 手机(用户名)
     */
    private String mobile;

    /**
     * 状态(1:启用;0:禁用)
     */
    private Boolean status;

    /**
     * 微信openid
     */
    private String wxOpenid;

    /**
     * 钉钉openid
     */
    private String ddOpenid;

    /**
     * token版本
     */
    private Integer tokenVersion;

    /**
     * 是否锁定
     */
    private Boolean locked;

    /**
     * 上次登录时间
     */
    private LocalDateTime lastLoginTime;

    /**
     * 上次登录ip
     */
    private String lastLoginIp;

    /**
     * 当前登录时间
     */
    private LocalDateTime currLoginTime;

    /**
     * 当前登录ip
     */
    private String currLoginIp;

    /**
     * 是否完成密码初始化修改
     */
    private Boolean pwdInited;

    /**
     * 描述
     */
    private String description;

    public User(OrgEnum org, String orgId, Boolean orgDefault, String name, String mobile, Boolean status) {
        this.org = org;
        this.orgId = orgId;
        this.orgDefault = orgDefault;
        this.name = name;
        this.mobile = mobile;
        this.status = status;
    }
}
